# 验证是否为搜索二叉树
# 如果为搜索二叉树，则中序遍历时，会按照递增的顺序

from math import inf

class Solution:
    pre = -inf
    def isValidBST(self, root) -> bool:

        if not root:
            return True
        
        if not self.isValidBST(root.left):

            return False
        
        if root.val <= self.pre:
            return False
        
        self.pre = root.val

        return self.isValidBST(root.right)


